package org.gas.barapraja.handler;

import org.gas.barapraja.db.dao.AccountDao;
import org.gas.barapraja.db.entity.Account;
import org.gas.barapraja.util.GasAppContext;

public class AccountTokenDetails implements TokenDetails {
	
	private Account account;
	
	private int current;
	
	public AccountTokenDetails(){
	
	}

	public void decreaseToken(int token) {
		current=account.getToken().getTokenValue();
		current-=token;
		account.getToken().setTokenValue(current);
		account=GasAppContext.springConfiguredBean(AccountDao.class).update(account);
	}

	public void addToken(int token) {
		
	}

	public int getCurrent() {
		return current;
	}

	public void setAccount(Account account) {
		this.account = account;
	}
	
	
	

}
